package com.viphuli.app.tool.fragment;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.widget.BaseAdapter;
import android.widget.ListView;
import butterknife.Bind;

import com.loopj.android.http.RequestParams;
import com.viphuli.app.tool.R;
import com.viphuli.app.tool.bean.part.ArrangeRecord;
import com.viphuli.app.tool.common.AccessTokenKeeper;
import com.viphuli.app.tool.common.MyPageHelper;
import com.viphuli.app.tool.http.ApiRequest;

/**
 * 排班记录列表
 * 
 * @author li.li
 *
 */
public class ArrangeRecordListFragment extends BaseProgressFragment {

	@Bind(R.id.id_listview)
	protected ListView listview;

	private BaseAdapter adapter;

	List<ArrangeRecord> list = new ArrayList<ArrangeRecord>();

	@Override
	protected int obtainContentRes() {
		return R.layout.arrange_record_list;
	}

	@Override
	protected void initParams() {

	}

	@Override
	protected void initView() {

	}

	@Override
	protected void initData() {
		
		AccessTokenKeeper tokenKeeper = AccessTokenKeeper.readAccessToken(getActivity());
		if (tokenKeeper.isLogin()) {
			RequestParams params = new RequestParams();
			params.put("uid", tokenKeeper.getOpenId());
			params.put("circle_id", tokenKeeper.getUser().circleId());
			ApiRequest.arrangeRecordList.request(this, params);
		}

	}

	public ListView getListview() {
		return listview;
	}

	public List<ArrangeRecord> getList() {
		return list;
	}

	public void setAdapter(BaseAdapter adapter) {
		this.adapter = adapter;
	}

	public static void go(Activity act) {
		MyPageHelper.arrangeRecordList.showMyPage(act);
	}

}
